/*
*  Tab
*  选项卡
* */
function Tab(title, content) {
    for (var i = 0; i < title.length; i++) {
        title[i].index = i;
        title[i].onclick = function () {
            for (var i = 0; i < title.length; i++) {
                title[i].className = '';
                content[i].className = '';
            }
            this.className = 'active';
            content[this.index].className = 'active';
        }
    }
}


/*
* close_cover
* 关闭遮罩层
* */
function close_cover() {
    var cover = document.querySelector('.cover');
    cover.parentNode.removeChild(cover);
}


/*
* modal_alert
* 遮罩层弹出框
* */
function modal_alert(modal) {
    var htmlStr = '\
        <div class="cover">\
            <div class="modal modal-alert">\
                <div class="modal-header">' + modal.title + '</div>\
                <div class="modal-content modal-alert-content">' + modal.content + '</div>\
                <div class="modal-footer">\
                    <div onclick="close_cover()">确定</div>\
                </div>\
            </div>\
        </div>\
        ';
    document.body.insertAdjacentHTML('beforeEnd', htmlStr);
}


/*
* modal_confirm
* 遮罩层弹出框
* */
function modal_confirm(modal) {
    this.onConfirm = modal.onConfirm;
    var htmlStr = '\
        <div class="cover">\
            <div class="modal modal-confirm">\
                <div class="modal-header">' + modal.title + '</div>\
                <div class="modal-content modal-confirm-content">' + modal.content + '</div>\
                <div class="modal-footer">\
                    <div onclick="onConfirm(event)">确定</div>\
                    <div onclick="close_cover()">取消</div>\
                </div>\
            </div>\
        </div>\
        ';
    document.body.insertAdjacentHTML('beforeEnd', htmlStr);
}

/*
* NowDay
* 获取当天日期
* */
function NowDay() {
    var date = new Date();
    var y = date.getFullYear();
    var m = (date.getMonth() + 1).toString().length === 1 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var d = date.getDate().toString().length === 1 ? "0" + date.getDate() : date.getDate();
    return y + "-" + m + "-" + d;
}


/*
* getNextDay
* 获取下一天日期
* */
function getNextDay(date, interval) {
    if (typeof(interval) == "undefined" || (!interval && typeof(interval) != "undefined" && interval != 0)) {
        interval = 1;
    }
    var y = date.substr(0, 4);
    var m = date.substr(5, 2) - 1;
    var d = date.substr(8, 9);
    var today = new Date(y, m, d);
    var yesterday_milliseconds = today.getTime() + 1000 * 60 * 60 * 24 * interval;
    var yesterday = new Date();
    yesterday.setTime(yesterday_milliseconds);

    var strYear = yesterday.getFullYear();
    var strDay = yesterday.getDate();
    var strMonth = yesterday.getMonth() + 1;
    if (strMonth < 10) {
        strMonth = "0" + strMonth;
    }
    if (strDay < 10) {
        strDay = "0" + strDay;
    }
    return strYear + "-" + strMonth + "-" + strDay;
}


/*
* getPrevDay
* 获取上一天
* */
function getPrevDay(date, interval) {
    if (typeof(interval) == "undefined" || (!interval && typeof(interval) != "undefined" && interval != 0)) {
        interval = 1;
    }
    var y = date.substr(0, 4);
    var m = date.substr(5, 2) - 1;
    var d = date.substr(8, 9);
    var today = new Date(y, m, d);
    var yesterday_milliseconds = today.getTime() - 1000 * 60 * 60 * 24 * interval;
    var yesterday = new Date();
    yesterday.setTime(yesterday_milliseconds);

    var strYear = yesterday.getFullYear();
    var strDay = yesterday.getDate();
    var strMonth = yesterday.getMonth() + 1;
    if (strMonth < 10) {
        strMonth = "0" + strMonth;
    }
    if (strDay < 10) {
        strDay = "0" + strDay;
    }
    return strYear + "-" + strMonth + "-" + strDay;
}


/*
* unique
* 数组去重
* */
function unique(Array) {
    var res = [];
    var json = {};
    for (var i = 0; i < Array.length; i++) {
        if (!json[Array[i]]) {
            res.push(Array[i]);
            json[Array[i]] = 1;
        }
    }
    return res;
}


/*------------------------------------------------------------------------------------------------------------*/

/*
* 轮次表初始化
* */
var lastDate = "123", lastBgColor;

/*
* placeholder
* 轮次表加载框
* */
var placeholder = new PlaceHolder({
    zIndex: 99999999999999,
    type: 'loading',
    color: '#FFF',
    background: 'rgba(0,0,0,.6)',
    text: "正在加速加载中...",
    template:
        '<img class="vii-placeholder-loading" src="images/loading.gif" width="30"/>\
         <span class="vii-placeholder-label" style="display: block;margin-top: 10px;font-size: 1.6rem">{{ text }}</span>'
});

/*
* getRound
* 获取当前轮次
* */
function getRoundAjax(callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getThisRound",
        dataType: 'jsonp',
        type: 'GET',
        success: function (item) {
            callback(item);
        },
        error: function (error) {
            alert("获取当前轮次请求失败！");
        }
    });
}

/*
* getNurseList
* 获取护士列表
* */
function getNurseList(callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getNurse",
        dataType: 'jsonp',
        type: 'get',
        success: function (item) {
            callback(item);
        },
        error: function (error) {
            alert("护士列表请求失败！");
        }
    });
}


/*
* getNurseVillage
* 获取护士管理浆员所在的村落
* */
function getNurseVillage(nurseid, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getNurseVill",
        dataType: 'jsonp',
        data: {
            nurseId: nurseid
        },
        type: 'POST',
        success: function (item) {
            callback(item);
        },
        error: function (error) {
            alert("护士管理浆员所在的村落请求失败！");
        }
    });
}

/*
* getNurseTypeVillage
* 获取护士管理浆员的每个类型所在的村落
* */
function getNurseTypeVillage(nurseid, type, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getByVills",
        dataType: 'jsonp',
        data: {
            nurseId: nurseid,
            gjzType: type
        },
        type: 'POST',
        success: function (item) {
            callback(item);
        },
        error: function (error) {
            alert("护士管理浆员所在的村落请求失败！");
        }
    });
}

/*
* getNurseTypePeople
* 获取护士管理浆员的每个类型的人
* */
function getNurseTypePeople(nurseid, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getjylxNum",
        dataType: 'jsonp',
        data: {
            nurseId: nurseid
        },
        type: 'POST',
        success: function (item) {
            callback(item);
        },
        error: function (error) {
            alert("护士管理类型的人数请求失败！");
        }
    });
}


/*
* getImportPulpData
* 获取重点浆员类型
* */
function getImportPulpData(callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getzdjylx",
        dataType: 'jsonp',
        success: function (list) {
            callback(list);
        },
        error: function (error) {
            alert("获取重点浆员类型失败！");
        }
    });
}

/*
* setManageNurse
* 修改管理护士
* */
function setManageNurse(arr, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/updateProviderManageMsg",
        dataType: "text",
        contentType: "application/json",
        data: JSON.stringify(arr),
        type: 'POST',
        beforeSend: function () {
            placeholder.show(document.body);
        },
        success: function (list) {
            alert("提交成功!");
            placeholder.hide(document.body);
            $(".vii-holder-mask").hide();
            callback(list);
        },
        error: function (error) {
            alert("提交失败！");
            placeholder.hide(document.body);
            $(".vii-holder-mask").hide();
        }
    });
}


/*-----------------------------------------------------------------------------------------*/

/*
* getClinicalDetail
* 临床反应数据
* */
function getClinicalDetail(date, id, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getLcBlfy",
        dataType: "jsonp",
        type: 'POST',
        data: {
            date: date,
            providerNo: id
        },
        beforeSend: function () {
            placeholder.show(document.body);
        },
        success: function (item) {
            callback(item);
        },
        error: function (error) {
            alert("获取临床反应详细信息请求失败！");
            placeholder.hide(document.body);
            $(".vii-holder-mask").hide();
        }
    });
}

/*
* openClinicalResponse
* 打开临床反应
* */
function openClinicalResponse(date, event, cardID) {
    $("#popup").css({
        display: "block",
        width: "800px"
    });
    GetSameDayInAllPulp(date, event);
    autoCenter($("#popup"));
    getClinicalDetail(date, cardID, function (item) {
        initClinicalPopup(item);
    });
}

/*
* initClinicalPopup
* 生成临床反应
* */
function initClinicalPopup(item) {
    $("#popup>h1").text("临床反应详细信息");
    var html =
        "<div class='clinical clinical2'>" +
        "<p class='popup-title'>基本信息</p>" +
        "<div class='col-1'>" +
        "<em>浆员姓名</em><span>" + (item.jyxm ? item.jyxm : "") + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>记录编号</em><span>" + (item.ycid ? item.ycid : "") + "</span>" +
        "</div>" +
        "</div>" +
        "<div class='clinical clinical2'>" +
        "<p class='popup-title'>临床反应信息</p>" +
        "<div class='col-2'>" +
        "<em>护士姓名</em><span>" + (item.hsxm ? item.hsxm : "") + "</span>" +
        "<em>机器编号</em><span>" + (item.mac_id ? item.mac_id : ""  ) + "</span>" +
        "</div>" +
        "<div class='col-2'>" +
        "<em>体温（℃）</em><span>" + (item.tw ? item.tw : "") + "</span>" +
        "<em>发生时间</em><span>" + (item.fsrq ? item.fsrq : "" ) + "</span>" +
        "</div>" +
        "<div class='col-2'>" +
        "<em>创建时间</em><span>" + (item.cjsj ? item.cjsj : "") + "</span>" +
        "<em>修改时间</em><span>" + (item.xgsj ? item.xgsj : "") + "</span>" +
        "</div>" +
        "<div class='col-2'>" +
        "<em>氯化钠注射液批号</em><span>" + (item.naclph ? item.naclph : "" ) + "</span>" +
        "<em>血浆单采分离器批号</em><span>" + (item.flqph ? item.flqph : "") + "</span>" +
        "</div>" +
        "<div class='col-2'>" +
        "<em>枸橼酸钠抗凝剂批号</em><span>" + (item.knjph ? item.knjph : "") + "</span>" +
        "<em>脉搏（次/分）</em><span>" + (item.mb ? item.mb : "") + "</span>" +
        "</div>" +
        "<div class='col-2'>" +
        "<em>心率（次/分）</em><span>" + (item.xl ? item.xl : "") + "</span>" +
        "<em>收缩压（mmHg）</em><span>" + (item.ssy ? item.ssy : "") + "</span>" +
        "</div>" +
        "<div class='col-2'>" +
        "<em>舒张压（mmHg）</em><span>" + (item.szy ? item.szy : "") + "</span>" +
        "<em>发生阶段</em><span>" + (item.fsjd ? item.fsjd : "") + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>临床不良反应现象</em><span>" + (item.lcblfyxx ? item.lcblfyxx : "" ) + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>临床不良反应分类</em><span>" + (item.lcblfyfl ? item.lcblfyfl : "" ) + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>临床不良反应原因</em><span>" + (item.lcblfyyy ? item.lcblfyyy : "") + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>临床不良反应处理措施</em><span>" + (item.lcclcs ? item.lcclcs : "") + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>恢复情况描述</em><span>" + (item.hfqk ? item.hfqk : "" ) + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>临床恢复情况</em><span>" + (item.lchfqk ? item.lchfqk : "") + "</span>" +
        "</div>" +
        "</div>" +
        "<div class='clinical clinical3'>" +
        "<p class='popup-title'>回访信息</p>" +
        "<div class='col-2'>" +
        "<em>回访日期</em><span>" + (item.hfrq ? item.hfrq : "") + "</span>" +
        "<em>浆员回访方式</em><span>" + (item.hffs ? item.hffs : "") + "</span>" +
        "</div>" +
        "<div class='col-2'>" +
        "<em>主叫号码</em><span>" + (item.zjhm ? item.zjhm : "") + "</span>" +
        "<em>被叫号码</em><span>" + (item.bjhm ? item.bjhm : "") + "</span>" +
        "</div>" +
        "<div class='col-2'>" +
        "<em>鉴定医生</em><span>" + (item.assessor ? item.assessor : "") + "</span>" +
        "<em>是否已回访</em><span>" + (item.sfyhf ? item.sfyhf : "") + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>浆员回访结果</em><span>" + (item.hfjg ? item.hfjg : "") + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>备注</em><span>" + (item.remark ? item.remark : "") + "</span>" +
        "</div>" +
        "</div>";
    $("#popup .popup-content").html(html);
    $(".popup .col-1 span").width($(".popup .col-1").width() - $(".popup .col-1 em").width());
    $(".popup .col-2 span").width(($(".popup .col-2").width() - $(".popup .col-2 em").width() * 2 + 13) / 2 - 14);
    dragPopup("#popup");
    placeholder.hide(document.body);
    $(".vii-holder-mask").hide();
}


/*---------------------------------------------------------------------------------------------*/

/*
* getUnqualifiedAndNoPulp
* 不合格浆员详情数据
* */
function getUnqualifiedAndNoPulp(date, id, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getJyState",
        dataType: "jsonp",
        data: {
            startTime: date,
            cardId: id
        },
        beforeSend: function () {
            placeholder.show(document.body);
        },
        success: function (item) {
            callback(item);

                    },
        error: function (error) {
            alert("获取不合格浆员与建档未献浆浆员信息请求失败！");
            placeholder.hide(document.body);
            $(".vii-holder-mask").hide();
        }
    });
}

/*
* openUnqualifiedAndNoPulp
* 打开不合格浆员
* */
function openUnqualifiedAndNoPulp(date, event, cardID) {
    $("#popup").css({
        display: "block",
        width: "800px"
    });
    GetSameDayInAllPulp(date, event);
    autoCenter($("#popup"));
    getUnqualifiedAndNoPulp(date, cardID, function (item) {
        initUnqualifiedAndNoPulp(item);
    });
}

/*
* initUnqualifiedAndNoPulp
* 生成不合格浆员
* */
function initUnqualifiedAndNoPulp(item) {
    $("#popup>h1").text("R浆员与建档未献浆浆员详情！");
    var mx = item.mx, jy = item.jy;
    var html;
    if (mx.length > 0) {
        var together = item.together;
        html =
            "<div class='clinical clinical2'>" +
            "<p class='popup-title'>检验详情</p>" +
            "<div class='col-2'>" +
            "<em>浆员姓名</em><span>" + mx[0].xm + "</span>" +
            "<em>浆员卡号</em><span>" + (mx[0].cardid ? mx[0].cardid : "") + "</span>" +
            "</div>" +
            "<div class='col-2'>" +
            "<em>登记时间</em><span>" + (mx[0].createrq ? mx[0].createrq.substr(0, 16) : "") + "</span>" +
            "<em>介绍人</em><span>" + (mx[0].jsr ? mx[0].jsr : "") + "</span>" +
            "</div>" +
            "<div class='col-2'>" +
            "<em>体检开始时间</em><span>" + (mx[0].tjcjsj ? mx[0].tjcjsj.substr(0, 16) : "") + "</span>" +
            "<em>体检结束时间</em><span>" + (mx[0].tjjssj ? mx[0].tjjssj.substr(0, 16) : "") + "</span>" +
            "</div>" +
            "<div class='col-1'>" +
            "<em>体检结果</em><span>" + (mx[0].tjjg === "1" ? "合格" : "不合格") + "</span>" +
            "</div>" +
            ( mx[0].tjjg !== "1" ?
                    ("<div class='col-2'>" +
                        "<em>乙肝</em><span>" + (mx[0].hbsag ? ( mx[0].hbsag === "1" ? "合格" : "不合格") : "") + "</span>" +
                        "<em>丙型肝炎病毒</em><span>" + (mx[0].khcv ? ( mx[0].khcv === "1" ? "合格" : "不合格") : "") + "</span>" +
                        "</div>" +
                        "<div class='col-2'>" +
                        "<em>艾滋病</em><span>" + (mx[0].khiv ? ( mx[0].khiv === "1" ? "合格" : "不合格") : "") + "</span>" +
                        "<em>梅毒</em><span>" + (mx[0].md ? ( mx[0].md === "1" ? "合格" : "不合格") : "") + "</span>" +
                        "</div>" +
                        "<div class='col-1'>" +
                        "<em>丙氨酸转氨酶</em><span>" + (mx[0].alt ? ( mx[0].alt === "1" ? "合格" : "不合格") : "") + "</span>" +
                        "</div>")
                    : ""
            ) +
            "<div class='col-1'>" +
            "<em>小样记录时间</em><span>" + (mx[0].jlsj ? mx[0].jlsj.substr(0, 16) : "") + "</span>" +
            "</div>" +
            "<div class='col-2'>" +
            "<em>化检开始时间</em><span>" + (mx[0].jlkssj ? mx[0].jlkssj.substr(0, 16) : "") + "</span>" +
            "<em>化检结束时间</em><span>" + (mx[0].jljssj ? mx[0].jljssj.substr(0, 16) : "") + "</span>" +
            "</div>" +
            "<div class='col-1'>" +
            "<em>化检结果</em><span>" + (mx[0].hjjg === "1" ? "合格" : "不合格") + "</span>" +
            "</div>" +
            "<div class='col-2'>" +
            "<em>胸片上传时间</em><span>" + (mx[0].lastbodycheckdate ? mx[0].lastbodycheckdate.substr(0, 16) : "") + "</span>" +
            "<em>胸片结果</em><span>" + (mx[0].xtgg === "1" ? "合格" : "不合格") + "</span>" +
            "</div>" +
            (
                (mx[0].tjjg !== "1" || mx[0].hjjg !== "1" || mx[0].xtgg !== "1") ?
                    ( "<div class='col-1'>" +
                        "<em>不合格原因</em><span>" + (mx[0].ttyy ? mx[0].ttyy : "") + "</span>" +
                        "</div>"
                    ) : ""
            ) +
            "</div>" +
            (
                (item.hasOwnProperty("together") && together.length > 0) ?
                    (
                        "<div class='clinical clinical2'>" +
                        "<p class='popup-title'>结伴浆员</p>" +
                        "<table id='companions'></table>"
                    ) : ""
            ) +
            "<div class='clinical clinical2'>" +
            "<p class='popup-title'>检验图</p>" +
            "<div class='' id='UnqualifiedAndNoPulp' style='width: 100%;height: 120px;'></div>" +
            "</div>";
        $("#popup .popup-content").html(html);
        /*
        * 图表
        * */
        var myChart = echarts.init(document.getElementById("UnqualifiedAndNoPulp"));
        var data = ["登记", "体检", "采样", "化检", "胸片"];
        var option = {
            color: [
                '#e95e48',
                '#DC951F',
                '#DDB100',
                '#DAD503',
                '#8AC867',
                '#37B8D4',
                '#7BCFE7',
                '#6A9BD3'
            ],
            tooltip: {
                triggerOn: "click",
                padding: [5, 10],
                formatter: function (params) {
                    if (params.value.length === 4) {
                        var matter = params.seriesName + '<br/>' +
                            "时间段：" + params.value[1].substr(11, 8) + '&nbsp;---&nbsp;' + params.value[2].substr(11, 8) + '<br/>' +
                            "时长：" + params.value[3];
                        return matter;
                    } else if (params.value.length === 2) {
                        var matter = params.seriesName + '<br/>' +
                            "时间：" + params.value[0].substr(11, 8);
                        return matter;
                    }
                }
            },
            grid: {
                top: 30,
                left: 50,
                right: 20
            },
            legend: (function () {
                var legend = [];
                for (var i = 0; i < data.length; i++) {
                    legend.push({name: data[i], icon: "circle"})
                }
                return legend;
            }()),
            xAxis: {
                type: 'time',
                splitLine: {
                    show: false
                }
            },
            yAxis: {
                type: 'category',
                data: ['']
            },
            series: [
                {
                    name: "登记",
                    type: 'scatter',
                    itemStyle: {
                        normal: {
                            opacity: 1
                        }
                    },
                    data: [
                        [mx[0].createrq, 0]
                    ]
                },
                {
                    name: "体检",
                    type: 'custom',
                    encode: {
                        x: [1, 2],
                        y: 0
                    },
                    renderItem: function (params, api) {
                        var categoryIndex = api.value(0);
                        var start = api.coord([api.value(1), categoryIndex]);
                        var end = api.coord([api.value(2), categoryIndex]);
                        return {
                            type: 'rect',
                            shape: echarts.graphic.clipRectByRect(
                                {
                                    x: start[0],
                                    y: start[1] - 2,
                                    width: end[0] - start[0],
                                    height: 10
                                },
                                {
                                    x: params.coordSys.x,
                                    y: params.coordSys.y,
                                    width: params.coordSys.width,
                                    height: params.coordSys.height
                                }
                            ),
                            style: api.style()
                        };
                    },
                    itemStyle: {
                        normal: {
                            opacity: 1
                        }
                    },
                    data: [
                        {
                            name: "体检",
                            value: ["", mx[0].tjcjsj, mx[0].tjjssj, mx[0].tjSpace]
                        }
                    ]
                },
                {
                    name: "采样",
                    type: 'scatter',
                    itemStyle: {
                        normal: {
                            opacity: 1
                        }
                    },
                    data: [
                        [mx[0].jlsj, 0]
                    ]
                },
                {
                    name: "化检",
                    type: 'custom',
                    encode: {
                        x: [1, 2],
                        y: 0
                    },
                    renderItem: function (params, api) {
                        var categoryIndex = api.value(0);
                        var start = api.coord([api.value(1), categoryIndex]);
                        var end = api.coord([api.value(2), categoryIndex]);
                        return {
                            type: 'rect',
                            shape: echarts.graphic.clipRectByRect(
                                {
                                    x: start[0],
                                    y: start[1] - 2,
                                    width: end[0] - start[0],
                                    height: 10
                                },
                                {
                                    x: params.coordSys.x,
                                    y: params.coordSys.y,
                                    width: params.coordSys.width,
                                    height: params.coordSys.height
                                }
                            ),
                            style: api.style()
                        };
                    },
                    itemStyle: {
                        normal: {
                            opacity: 1
                        }
                    },
                    data: [
                        {
                            name: "化检",
                            value: ["", mx[0].jlkssj, mx[0].jljssj, mx[0].hjSpace]
                        }
                    ]
                },
                {
                    name: "胸片",
                    type: 'scatter',
                    itemStyle: {
                        normal: {
                            opacity: 1
                        }
                    },
                    data: [
                        [mx[0].lastbodycheckdate, 0]
                    ]
                }
            ]
        };
        myChart.setOption(option);

        /*
        * 结伴浆员列表
        * */
        if (item.hasOwnProperty("together") && together.length > 0) {
            $("#companions").bootstrapTable('destroy').bootstrapTable({
                cache: false,
                data: together,
                height: (together.length > 7) ? "200" : "",
                undefinedText: "",
                columns: [
                    {
                        width: "10%",
                        title: '序号',
                        sortable: true,
                        class: "padding_5",
                        formatter: function (value, row, index) {
                            return index + 1;
                        }
                    },
                    {
                        field: "xm",
                        title: '姓名',
                        sortable: true,
                        class: "padding_5",
                        width: "15%"
                    },
                    {
                        field: 'cardid',
                        width: "15%",
                        sortable: true,
                        class: "padding_5",
                        title: '卡号'
                    },
                    {
                        field: 'regtime',
                        width: "30%",
                        sortable: true,
                        class: "padding_5",
                        title: '进站时间',
                        formatter: function (value, row, index) {
                            return value.substr(0, 16);
                        }
                    },
                    {
                        field: 'end_TIME',
                        width: "30%",
                        sortable: true,
                        class: "padding_5",
                        title: '出站时间',
                        formatter: function (value, row, index) {
                            return value ? value.substr(0, 16) : row.tjjssj.substr(0, 16);
                        }
                    }
                ]
            });
        }

    } else if (jy.length > 0) {
        html =
            "<div class='clinical clinical2'>" +
            "<p class='popup-title'>检验详情</p>" +
            "<div class='col-2'>" +
            "<em>浆员姓名</em><span>" + jy[0].name + "</span>" +
            "<em>浆员卡号</em><span>" + (jy[0].providerNo ? jy[0].providerNo : "") + "</span>" +
            "</div>" +
            "<div class='col-2'>" +
            "<em>登记时间</em><span>" + (jy[0].fileDate ? jy[0].fileDate.substr(0, 11) : "") + "</span>" +
            "<em>介绍人</em><span>" + (jy[0].jsr_GZZXX ? jy[0].jsr_GZZXX : "") + "</span>" +
            "</div>" +
            "<div class='col-2'>" +
            "<em>体检日期</em><span>" + (jy[0].bodyCheckDate ? jy[0].bodyCheckDate.substr(0, 11) : "") + "</span>" +
            "<em>体检结果</em><span>" + (jy[0].bodyCheckResult ? (jy[0].bodyCheckResult === "1" ? "合格" : "不合格") : "" ) + "</span>" +
            "</div>" +
            (
                jy[0].bodyCheckResult !== "1" ?
                    ( "<div class='col-2'>" +
                        "<em>体检拒绝状态</em><span>" + (jy[0].docResult ? jy[0].docResult : "") + "</span>" +
                        "<em>体检拒绝原因</em><span>" + (jy[0].remark ? jy[0].remark : "") + "</span>" +
                        "</div>" +
                        "<div class='col-1'>" +
                        "<em>体检拒绝其他原因</em><span>" + (jy[0].otherRefusereason ? jy[0].otherRefusereason : "") + "</span>" +
                        "</div>"
                    ) : ""
            ) +
            "<div class='col-2'>" +
            "<em>化检日期</em><span>" + (jy[0].assayDate ? jy[0].assayDate.substr(0, 11) : "") + "</span>" +
            "<em>化检结果</em><span>" + (jy[0].assayResult ? (jy[0].assayResult === "1" ? "合格" : "不合格") : "") + "</span>" +
            "</div>" +
            (
                jy[0].assayResult !== "1" ?
                    ( "<div class='col-2'>" +
                        "<em>化检拒绝状态</em><span>" + (jy[0].assDocResult ? jy[0].assDocResult : "") + "</span>" +
                        "<em>化检拒绝原因</em><span>" + (jy[0].assRemark ? jy[0].assRemark : "") + "</span>" +
                        "</div>"
                    ) : ""
            ) +
            "<div class='col-1'>" +
            "<em>胸片上传时间</em><span>" + (jy[0].lastbodycheckdate ? jy[0].lastbodycheckdate.substr(0, 11) : "") + "</span>" +
            "</div>" +
            "<div class='col-1'>" +
            "<em>胸片结果</em><span>" + (jy[0].xtgg ? jy[0].xtgg : "") + "</span>" +
            "</div>" +
            "</div>" +
            "</div>";
        $("#popup .popup-content").html(html);
    }

    $(".popup .col-1 span").width($(".popup .col-1").width() - $(".popup .col-1 em").width());
    $(".popup .col-2 span").width(($(".popup .col-2").width() - $(".popup .col-2 em").width() * 2) / 2 - 9);
    dragPopup("#popup");
    placeholder.hide(document.body);
    $(".vii-holder-mask").hide();
}


/*----------------------------------------------------------------------------------------*/

/*
* getStep5LinkDetail
* 五步链接数据
* */
function getStep5LinkDetail(date, id, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getFiveLink",
        dataType: "jsonp",
        data: {
            date: date,
            cardId: id
        },
        beforeSend: function () {
            placeholder.show(document.body);
        },
        success: function (item) {
            callback(item);
        },
        error: function (error) {
            alert("获取五步链接详细信息请求失败！");
            placeholder.hide(document.body);
            $(".vii-holder-mask").hide();
        }
    });
}

/*
* openStep5Link
* 打开五步链接
* */
function openStep5Link(date, event, cardID) {
    $("#popup1").css({
        display: "block",
        width: "800px"
    });
    autoCenter($("#popup1"));
    GetSameDayInAllPulp(date, event);
    getStep5LinkDetail(date, cardID, function (item) {
        initStep5LinkPopup(item);
    });
}

/*
* initStep5Link
* 生成五步链接
* */
function initStep5LinkPopup(item) {
    $("#popup1>h1").text("五步链接详细信息");
    var html =
        "<div class='clinical clinical2'>" +
        "<p class='popup-title'>基本信息</p>" +
        "<div class='col-2'>" +
        "<em>浆员姓名</em><span>" + (item[0].jyxm ? item[0].jyxm : "") + "</span>" +
        "<em>护士姓名</em><span>" + (item[0].hsxm ? item[0].hsxm : "") + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>链接时间</em><span>" + (item[0].ljtime ? item[0].ljtime.substr(0, 16) : "" ) + "</span>" +
        "</div>" +
        "</div>" +
        "<div class='clinical clinical2'>" +
        "<p class='popup-title'>五步链接信息</p>" +
        "<div class='col-2'>" +
        "<em>五步链接环节</em><span>" + (item[0].ljhj ? item[0].ljhj : "") + "</span>" +
        "<em>五步链接承诺</em><span>" + (item[0].ljcn ? item[0].ljcn : "" ) + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>五步链接效果</em><span>" + (item[0].ljxg ? item[0].ljxg : "") + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>家人参与献浆</em><span>" + (item[0].jrcyxj ? item[0].jrcyxj : "") + "</span>" +
        "</div>" +
        "<div class='col-1'>" +
        "<em>朋友参与献浆</em><span>" + (item[0].pycyxj ? item[0].pycyxj : "" ) + "</span>" +
        "</div>" +
        "</div>";
    $("#popup1 .popup-content").html(html);
    $("#popup1 .col-1 span").width($("#popup1  .col-1").width() - $("#popup1 .col-1 em").width());
    $("#popup1 .col-2 span").width(($("#popup1 .col-2").width() - $("#popup1 .col-2 em").width() * 2) / 2 - 7);
    dragPopup("#popup1");
    placeholder.hide(document.body);
    $(".vii-holder-mask").hide();
}

/*
* openStep5AndClinical
* 打开五步链接与临床反应
* */
function openStep5AndClinical(date, event, cardID) {
    $("#popup,#popup1").css({
        display: "block",
        width: "800px"
    });
    autoCenter($("#popup,#popup1"));
    GetSameDayInAllPulp(date, event);
    getClinicalDetail(date, cardID, function (item) {
        initClinicalPopup(item);
    });
    getStep5LinkDetail(date, cardID, function (item) {
        initStep5LinkPopup(item);
    });
}


/*-----------------------------------------------------------------------------------------*/

/*
* getNotPulpCommunication
* 献浆沟通内容数据
* */
function getNotPulpCommunication(id, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getGtjl",
        dataType: "jsonp",
        type: 'POST',
        data: {
            providerNo: id
        },
        beforeSend: function () {
            placeholder.show(document.body);
        },
        success: function (item) {
            callback(item);
        },
        error: function (error) {
            alert("未沟通记录请求失败！");
            placeholder.hide(document.body);
            $(".vii-holder-mask").hide();
        }
    });
}

/*
* openNotPulpCommunication
* 打开献浆沟通内容
* */
function openNotPulpCommunication(cardID) {
    $("#popup").css({
        display: "block",
        width: "1100px"
    });
    autoCenter($("#popup"));
    getNotPulpCommunication(cardID, function (item) {
        initNotPulpPopup(item);
    });
}

/*
* initNotPulpPopup
* 生成献浆原因
* */
function initNotPulpPopup(item) {
    var html = '<p>' +
        '<span>未献浆沟通记录</span>' +
        '<span>提醒记录</span>' +
        '<span>回访记录</span>' +
        '</p>' +
        '<div class="noPulp-details">' +
        '<table></table>' +
        '</div>' +
        '<div class="remind-details" >' +
        '<table></table>' +
        '</div>' +
        '<div class="return-visit-details">' +
        '<table></table>' +
        '</div>';
    $("#popup>h1").html("<span style='color:red;'>" + (item.wxjjl.length > 0 ? item.wxjjl[0].jyxm : (item.rem.length > 0 ? item.rem[0].providerName : (item.comm.length > 0 ? item.comm[0].providerName : ""))) + "</span>沟通详细信息");
    $("#popup .popup-content").html(html);
    $("#popup .noPulp-details>table").bootstrapTable('destroy').bootstrapTable({
        cache: false,
        data: item.wxjjl,
        height: (item.wxjjl.length > 8 || item.rem.length > 8 || item.comm.length > 8) ? "300" : "160",
        undefinedText: "",
        columns: [
            {
                width: "8%",
                title: '序号',
                sortable: true,
                formatter: function (value, row, index) {
                    return index + 1;
                }
            },
            {
                field: "gths",
                title: '沟通护士',
                sortable: true,
                width: "15%"
            },
            {
                field: 'gtsj',
                width: "32%",
                sortable: true,
                title: '沟通时间',
                formatter: function (value, row, index) {
                    return value ? value.substr(0, 16) : "";
                }
            }, {
                field: 'wxjyy',
                width: "45%",
                sortable: true,
                title: '沟通内容'
            }
        ]
    });
    $("#popup .remind-details>table").bootstrapTable('destroy').bootstrapTable({
        cache: false,
        data: item.rem,
        height: (item.wxjjl.length > 8 || item.rem.length > 8 || item.comm.length > 8) ? "300" : "160",
        undefinedText: "",
        columns: [
            {
                width: "8%",
                title: '序号',
                sortable: true,
                formatter: function (value, row, index) {
                    return index + 1;
                }
            },
            {
                field: "nurseName",
                title: '提醒护士',
                sortable: true,
                width: "24%"
            },
            {
                field: 'scsj',
                width: "34%",
                sortable: true,
                title: '提醒生成时间'
            }, {
                field: 'wcsj',
                width: "34%",
                sortable: true,
                title: '提醒完成时间'
            }
        ]
    });
    $("#popup .return-visit-details>table").bootstrapTable('destroy').bootstrapTable({
        cache: false,
        data: item.comm,
        height: (item.wxjjl.length > 8 || item.rem.length > 8 || item.comm.length > 8) ? "300" : "160",
        undefinedText: "",
        columns: [
            {
                width: "5%",
                title: '序号',
                sortable: true,
                formatter: function (value, row, index) {
                    return index + 1;
                }
            },
            {
                field: "nurseName",
                title: '沟通护士',
                sortable: true,
                width: "10%"
            },
            {
                field: 'scsj',
                width: "17%",
                sortable: true,
                title: '沟通生成时间'
            },
            {
                field: 'wcsj',
                width: "17%",
                sortable: true,
                title: '沟通完成时间'
            },
            {
                field: 'gtfs',
                width: "10%",
                sortable: true,
                title: '沟通方式'
            },
            {
                field: 'gtzt',
                width: "10%",
                sortable: true,
                title: '沟通状态',
                formatter: function (value, row, index) {
                    return value === "0" ? "未沟通" : "已沟通";
                }
            },
            {
                field: 'gtnr',
                width: "31%",
                sortable: true,
                title: '沟通内容'
            }
        ]
    });

    placeholder.hide(document.body);
    $(".vii-holder-mask").hide();
    dragPopup("#popup");
}

/*-----------------------------------------------------------------------------------------*/

/*
* getChangeNurseHistory
* 护士修改的记录数据
* */
function getChangeNurseHistory(cardID, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getNurseChangeHis",
        dataType: "jsonp",
        type: 'POST',
        data: {
            providerNo: cardID
        },
        beforeSend: function () {
            placeholder.show(document.body);
        },
        success: function (item) {
            callback(item);
        },
        error: function (error) {
            alert("查看修改护士历史请求失败！");
            placeholder.hide(document.body);
            $(".vii-holder-mask").hide();
        }
    });
}

/*
* openNurseHistory
* 打开护士修改的记录
* */
function openNurseHistory(cardID) {
    $("#popup").css({
        display: "block",
        width: "800px"
    });
    autoCenter($("#popup"));
    getChangeNurseHistory(cardID, function (item) {
        if (item.length > 0) {
            initNurseHistoryPopup(item);
        } else {
            closePopup();
            placeholder.hide(document.body);
            $(".vii-holder-mask").hide();
            alert("未修改记录！");
        }
    });
}

/*
* initNurseHistoryPopup
* 生成护士修改的记录
* */
function initNurseHistoryPopup(item) {
    var html = '<table></table>';
    $("#popup>h1").text("修改护士记录信息");
    $("#popup .popup-content").html(html);

    $("#popup .popup-content>table").bootstrapTable('destroy').bootstrapTable({
        cache: false,
        data: item,
        height: item.length > 8 ? "300" : "160",
        undefinedText: "",
        columns: [
            {
                width: "5%",
                title: '序号',
                sortable: true,
                formatter: function (value, row, index) {
                    return index + 1;
                }
            },
            {
                field: "providerName",
                title: '浆员姓名',
                sortable: true,
                width: "20%"
            },
            {
                field: 'bhs',
                width: "25%",
                sortable: true,
                title: '修改前护士'
            },
            {
                field: 'ahs',
                width: "25%",
                sortable: true,
                title: '修改后护士'
            },
            {
                field: 'xgsj',
                width: "25%",
                sortable: true,
                title: '修改时间',
                formatter: function (value, row, index) {
                    return value ? value.substr(0, 16) : "";
                }
            }
        ]
    });
    placeholder.hide(document.body);
    $(".vii-holder-mask").hide();
    dragPopup("#popup");
}


/*-------------------------------------------------------------------------------------------*/

/*
* getVolunteer
* 获取义工数据
* */
function getVolunteer(parend, cardID, callback) {
    $.ajax({
        url: "http://60.164.210.223:7577/Nvr/map/getGjzxx",
        dataType: "jsonp",
        data: {
            code: cardID
        },
        type: 'POST',
        beforeSend: function () {
            placeholder.show(document.body);
        },
        success: function (item) {
            callback(parend, item);
        },
        error: function (error) {
            alert("义工列表请求失败！");
            placeholder.hide(document.body);
            $(".vii-holder-mask").hide();
        }
    });
}

/*
* openVolunteer
* 打开义工搜索栏
* */
function openVolunteer(event, cardID) {
    var parend = event.parentNode;
    var span = parend.querySelector("span:first-Child").innerText;
    $("#popup").css({
        display: "block",
        width: "800px"
    });
    autoCenter($("#popup"));
    getVolunteer(parend, (span === "" ? "张小" : span), function (parend, item) {
        initVolunteer(parend, item);
    });
}

/*
* initVolunteer
* 生成搜索义工
* */
function initVolunteer(parend, item) {
    var html = '<input type="search" placeholder="请输入义工姓名或义工卡号或身份证号..." class="search-volunteer">' +
        '<div class="search-list-body">' +
        '<table></table>' +
        '</div>';
    $("#popup>h1").text("修改链接义工");
    $("#popup .popup-content").html(html);
    $("#popup .search-list-body>table").bootstrapTable('destroy').bootstrapTable({
        cache: false,
        data: item,
        height: item.length > 16 ? "450" : "250",
        undefinedText: "",
        columns: [
            {
                width: "5%",
                title: '序号',
                sortable: true,
                class: "padding_5",
                formatter: function (value, row, index) {
                    return index + 1;
                }
            },
            {
                field: "photo",
                title: '头像',
                sortable: true,
                class: "padding_5",
                width: "15%",
                formatter: function (value, row, index) {
                    return "<img src='data:image/jpg;base64," + value + "'>";
                }
            },
            {
                field: 'cardid',
                width: "20%",
                sortable: true,
                class: "padding_5",
                title: '卡号'
            }, {
                field: 'xm',
                width: "20%",
                sortable: true,
                class: "padding_5",
                title: '姓名'
            },
            {
                field: 'sfz',
                width: "40%",
                sortable: true,
                class: "padding_5",
                title: '身份证号'
            }
        ]
    });

    $("#popup .search-list-body tr").on("click", function () {
        var id = $(this).find("td").eq(2).text();
        var name = "<span data-yigongid='" + id + "'>" + ($(this).find("td").eq(3).text()) + "</span>";
        var _span = '<span onclick="openVolunteer(this,' + id + ')" class="placehold-communication cursor" style="top:-25px;display: none;"></span>';
        parend.innerHTML = name + _span;
        closePopup();
    });
    $("#popup .search-volunteer").on("search", function () {
        getVolunteer(parend, $(this).val(), function (parend, item) {
            initVolunteer(parend, item);
        });
    });

    placeholder.hide(document.body);
    $(".vii-holder-mask").hide();
    dragPopup("#popup");
}


/*
* GetSameDayInAllPulp
* 圈出同一天献浆的人
* */
function GetSameDayInAllPulp(date, event) {
    $("#table .pulp-name-class.active").css("background", lastBgColor).removeClass("active");
    lastBgColor = event.style.background;
    event.className = "pulp-name-class active";
    event.style.background = "rgba(212, 53, 27, 0.6)";

    $("#table ." + lastDate).css("background", "");
    $("#table .pulp" + date).css("background", "rgba(212, 53, 27, 0.6)");
    var length = document.querySelectorAll("#table .pulp" + date).length;
    $("th.pulp-name").find(".th-inner").text("姓名\n" + date + "（" + length + " 人）");
    lastDate = "pulp" + date;
}

/*
* mouseoverToast
* 移动到上面显示小标题 最新沟通
* */
function mouseoverToast(event, text) {
    event.parentNode.querySelector(".placehold-communication").style.width = "100%";
    event.parentNode.querySelector(".placehold-communication").style.display = "block";
    event.parentNode.querySelector(".placehold-communication").innerText = text;
}

function mouseoutToast(event) {
    event.parentNode.querySelector(".placehold-communication").style.display = "none";
    event.parentNode.querySelector(".placehold-communication").innerText = "";
}

/*
* mouseoverRoundToast
* 移动到上面显示小标题 轮次
* */
function mouseoverRoundToast(event, value) {
    var index = value.substr(0, 1),
        text = value.substr(value.indexOf(":") + 1),
        date = value.substr(value.indexOf("2"), 10);
    if (event.parentNode.parentNode === event.parentNode.parentNode.parentNode.children[0]) {
        if (date.substr(0, 4) === "2018") {
            event.parentNode.querySelector(".placehold-communication").style.top = "27px";
        } else if (date.substr(0, 4) === "2017") {
            event.parentNode.querySelector(".placehold-communication").style.top = "17px";
        }
    } else {
        if (date.substr(0, 4) === "2018") {
            event.parentNode.querySelector(".placehold-communication").style.top = "-20px";
        } else if (date.substr(0, 4) === "2017") {
            event.parentNode.querySelector(".placehold-communication").style.top = "-30px";
        }
    }

    if (date.substr(5, 2) === "12" && text.length > 10) {
        event.parentNode.querySelector(".placehold-communication").style.left = "-93px";
    } else if (date.substr(5, 2) === "12" && text.length === 10) {
        event.parentNode.querySelector(".placehold-communication").style.left = "-65px";
    } else if (date.substr(5, 2) !== "12" && text.length > 10) {
        event.parentNode.querySelector(".placehold-communication").style.left = "-45px";
    } else if (date.substr(5, 2) !== "12" && text.length === 10) {
        event.parentNode.querySelector(".placehold-communication").style.left = "-30px";
    }

    event.parentNode.querySelector(".placehold-communication").style.width = text.length > 10 ? "120px" : "90px";
    event.parentNode.querySelector(".placehold-communication").style.display = "block";
    event.parentNode.querySelector(".placehold-communication").innerText = text;
}

function mouseoutRoundToast(event) {
    event.parentNode.querySelector(".placehold-communication").style.display = "none";
    event.parentNode.querySelector(".placehold-communication").innerText = "";
}

/*
* madeClassDate
* 做带时间的classc
* */
function madeClassDate(row) {
    var r1 = row.round1.substr(0, 1) !== "0" ? "pulp" + row.round1.substr(2, 10) : "";
    var r2 = row.round2.substr(0, 1) !== "0" ? "pulp" + row.round2.substr(2, 10) : "";
    var r3 = row.round3.substr(0, 1) !== "0" ? "pulp" + row.round3.substr(2, 10) : "";
    var r4 = row.round4.substr(0, 1) !== "0" ? "pulp" + row.round4.substr(2, 10) : "";
    var r5 = row.round5.substr(0, 1) !== "0" ? "pulp" + row.round5.substr(2, 10) : "";
    var r6 = row.round6.substr(0, 1) !== "0" ? "pulp" + row.round6.substr(2, 10) : "";
    var r7 = row.round7.substr(0, 1) !== "0" ? "pulp" + row.round7.substr(2, 10) : "";
    var r8 = row.round8.substr(0, 1) !== "0" ? "pulp" + row.round8.substr(2, 10) : "";
    var r9 = row.round9.substr(0, 1) !== "0" ? "pulp" + row.round9.substr(2, 10) : "";
    var r10 = row.round10.substr(0, 1) !== "0" ? "pulp" + row.round10.substr(2, 10) : "";
    var r11 = row.round11.substr(0, 1) !== "0" ? "pulp" + row.round11.substr(2, 10) : "";
    var r12 = row.round12.substr(0, 1) !== "0" ? "pulp" + row.round12.substr(2, 10) : "";
    var r13 = row.round13.substr(0, 1) !== "0" ? "pulp" + row.round13.substr(2, 10) : "";
    var r14 = row.round14.substr(0, 1) !== "0" ? "pulp" + row.round14.substr(2, 10) : "";
    var r15 = row.round15.substr(0, 1) !== "0" ? "pulp" + row.round15.substr(2, 10) : "";
    var r16 = row.round16.substr(0, 1) !== "0" ? "pulp" + row.round16.substr(2, 10) : "";
    var r17 = row.round17.substr(0, 1) !== "0" ? "pulp" + row.round17.substr(2, 10) : "";
    var r18 = row.round18.substr(0, 1) !== "0" ? "pulp" + row.round18.substr(2, 10) : "";
    var r19 = row.round19.substr(0, 1) !== "0" ? "pulp" + row.round19.substr(2, 10) : "";
    var r20 = row.round20.substr(0, 1) !== "0" ? "pulp" + row.round20.substr(2, 10) : "";
    var r21 = row.round21.substr(0, 1) !== "0" ? "pulp" + row.round21.substr(2, 10) : "";
    var r22 = row.round22.substr(0, 1) !== "0" ? "pulp" + row.round22.substr(2, 10) : "";
    var r23 = row.round23.substr(0, 1) !== "0" ? "pulp" + row.round23.substr(2, 10) : "";
    var r24 = row.round24.substr(0, 1) !== "0" ? "pulp" + row.round24.substr(2, 10) : "";
    var r25 = row.round25.substr(0, 1) !== "0" ? "pulp" + row.round25.substr(2, 10) : "";
    var r26 = row.round26.substr(0, 1) !== "0" ? "pulp" + row.round26.substr(2, 10) : "";
    var lr1 = row.lastRound1.substr(0, 1) !== "0" ? "pulp" + row.lastRound1.substr(2, 10) : "";
    var lr2 = row.lastRound2.substr(0, 1) !== "0" ? "pulp" + row.lastRound2.substr(2, 10) : "";
    var lr3 = row.lastRound3.substr(0, 1) !== "0" ? "pulp" + row.lastRound3.substr(2, 10) : "";
    var lr4 = row.lastRound4.substr(0, 1) !== "0" ? "pulp" + row.lastRound4.substr(2, 10) : "";
    var lr5 = row.lastRound5.substr(0, 1) !== "0" ? "pulp" + row.lastRound5.substr(2, 10) : "";
    var lr6 = row.lastRound6.substr(0, 1) !== "0" ? "pulp" + row.lastRound6.substr(2, 10) : "";
    var lr7 = row.lastRound7.substr(0, 1) !== "0" ? "pulp" + row.lastRound7.substr(2, 10) : "";
    var lr8 = row.lastRound8.substr(0, 1) !== "0" ? "pulp" + row.lastRound8.substr(2, 10) : "";
    var lr9 = row.lastRound9.substr(0, 1) !== "0" ? "pulp" + row.lastRound9.substr(2, 10) : "";
    var lr10 = row.lastRound10.substr(0, 1) !== "0" ? "pulp" + row.lastRound10.substr(2, 10) : "";
    var lr11 = row.lastRound11.substr(0, 1) !== "0" ? "pulp" + row.lastRound11.substr(2, 10) : "";
    var lr12 = row.lastRound12.substr(0, 1) !== "0" ? "pulp" + row.lastRound12.substr(2, 10) : "";
    var lr13 = row.lastRound13.substr(0, 1) !== "0" ? "pulp" + row.lastRound13.substr(2, 10) : "";
    var lr14 = row.lastRound14.substr(0, 1) !== "0" ? "pulp" + row.lastRound14.substr(2, 10) : "";
    var lr15 = row.lastRound15.substr(0, 1) !== "0" ? "pulp" + row.lastRound15.substr(2, 10) : "";
    var lr16 = row.lastRound16.substr(0, 1) !== "0" ? "pulp" + row.lastRound16.substr(2, 10) : "";
    var lr17 = row.lastRound17.substr(0, 1) !== "0" ? "pulp" + row.lastRound17.substr(2, 10) : "";
    var lr18 = row.lastRound18.substr(0, 1) !== "0" ? "pulp" + row.lastRound18.substr(2, 10) : "";
    var lr19 = row.lastRound19.substr(0, 1) !== "0" ? "pulp" + row.lastRound19.substr(2, 10) : "";
    var lr20 = row.lastRound20.substr(0, 1) !== "0" ? "pulp" + row.lastRound20.substr(2, 10) : "";
    var lr21 = row.lastRound21.substr(0, 1) !== "0" ? "pulp" + row.lastRound21.substr(2, 10) : "";
    var lr22 = row.lastRound22.substr(0, 1) !== "0" ? "pulp" + row.lastRound22.substr(2, 10) : "";
    var lr23 = row.lastRound23.substr(0, 1) !== "0" ? "pulp" + row.lastRound23.substr(2, 10) : "";
    var lr24 = row.lastRound24.substr(0, 1) !== "0" ? "pulp" + row.lastRound24.substr(2, 10) : "";
    var lr25 = row.lastRound25.substr(0, 1) !== "0" ? "pulp" + row.lastRound25.substr(2, 10) : "";
    var lr26 = row.lastRound26.substr(0, 1) !== "0" ? "pulp" + row.lastRound26.substr(2, 10) : "";

    var classDate = "" + r1 + " " + r2 + " " + r3 + " " + r4 + " " + r5 + " " + r6 + " " + r7 + " " + r8 + " " + r9 + " " + r10 + " " + r11 + " " + r12 + " " + r13 + " " + r14 + " " + r15 + " " + r16 + " " + r17 + " " + r18 + " " + r19 + " " + r20 + " " + r21 + " " + r22 + " " + r23 + " " + r24 + " " + r25 + " " + r26 + " " +
        lr1 + " " + lr2 + " " + lr3 + " " + lr4 + " " + lr5 + " " + lr6 + " " + lr7 + " " + lr8 + " " + lr9 + " " + lr10 + " " + lr11 + " " + lr12 + " " + lr13 + " " + lr14 + " " + lr15 + " " + lr16 + " " + lr17 + " " + lr18 + " " + lr19 + " " + lr20 + " " + lr21 + " " + lr22 + " " + lr23 + " " + lr24 + " " + lr25 + " " + lr26 + "";
    return classDate;
}

/*
* getRoundEle
* 轮次表格的元素生成
* */
function getRoundEle(value, row, index, lr, r) {
    var html = "<i " +
        "" + (lr.substr(0, 1) === "0" ? "" : "onmouseover='mouseoverRoundToast(this,\"" + lr + "\")'") + " " +
        "" + (lr.substr(0, 1) !== "0" ? "onmouseout='mouseoutRoundToast(this)'" : "" ) + " " +
        "" + (lr.substr(0, 1) === "5" ? "onclick='openUnqualifiedAndNoPulp(\"" + lr.substr(2, 10) + "\",this,\"" + row.providerNo + "\")'" :
            "" + (lr.substr(0, 1) === "4" ? "onclick='openStep5AndClinical(\"" + lr.substr(2, 10) + "\",this,\"" + row.providerNo + "\")'" :
            (lr.substr(0, 1) === "3" ? "onclick='openStep5Link(\"" + lr.substr(2, 10) + "\",this,\"" + row.providerNo + "\")'" :
                (lr.substr(0, 1) === "2" ? "onclick='openClinicalResponse(\"" + lr.substr(2, 10) + "\",this,\"" + row.providerNo + "\")'" :
                    (lr.substr(0, 1) === "1" ? "onclick='GetSameDayInAllPulp(\"" + lr.substr(2, 10) + "\",this)'" : ""))))) + " " +
        "" + (lr.substr(0, 1) === "1" ? "style='background: #03E590'" : ((lr.substr(0, 1) === "2" || lr.substr(0, 1) === "4") ? "style='background: red'" : (lr.substr(0, 1) === "3" ? "style='background: #F8AC2C'" : (lr.substr(0, 1) === "5" ? "style='background: #cc02ff'" : "")))) + " data-index='" + value.substr(0, 1) + "' data-row='" + madeClassDate(row) + "' class='pulp-name-class' ></i>" +
        "<i " +
        "" + (r.substr(0, 1) === "0" ? "" : "onmouseover='mouseoverRoundToast(this,\"" + r + "\")'") + " " +
        "" + (r.substr(0, 1) !== "0" ? "onmouseout='mouseoutRoundToast(this)'" : "" ) + " " +
        "" + (r.substr(0, 1) === "5" ? "onclick='openUnqualifiedAndNoPulp(\"" + r.substr(2, 10) + "\",this,\"" + row.providerNo + "\")'" :
            "" + (r.substr(0, 1) === "4" ? "onclick='openStep5AndClinical(\"" + r.substr(2, 10) + "\",this,\"" + row.providerNo + "\")'" :
            (r.substr(0, 1) === "3" ? "onclick='openStep5Link(\"" + r.substr(2, 10) + "\",this,\"" + row.providerNo + "\")'" :
                (r.substr(0, 1) === "2" ? "onclick='openClinicalResponse(\"" + r.substr(2, 10) + "\",this,\"" + row.providerNo + "\")'" :
                    (r.substr(0, 1) === "1" ? "onclick='GetSameDayInAllPulp(\"" + r.substr(2, 10) + "\",this)'" : ""))))) + " " +
        "" + (r.substr(0, 1) === "1" ? "style='background: #06B7E5'" : ((r.substr(0, 1) === "2" || r.substr(0, 1) === "4") ? "style='background: red'" : ((r.substr(0, 1) === "3" ? "style='background: #F8AC2C'" : (r.substr(0, 1) === "5" ? "style='background: #cc02ff'" : ""))))) + " ></i>" +
        "<span class='placehold-communication cursor' style='left:-30px;'></span>";
    return html;
}

/*
* closePopup
* 关闭小弹框
* */
function closePopup() {
    $("#popup").css("display", "none");
    $("#popup1").css("display", "none");
}

/*
* closePopup1
* 关闭小弹框1
* */
function closePopup1() {
    $("#popup1").css("display", "none");
}

/*
* autoCenter
* 自动居中对话框
* */
function autoCenter(el) {
    var bodyW = $(window).width();
    var bodyH = $(window).height();
    var elW = el.width();
    var elH = el.height();
    el.css({"left": (bodyW - elW) / 2 + 'px', "top": (bodyH - elH) / 2 + 'px'});
}

/*
* dragPopup
* 可拖拽小弹框
* */
function dragPopup(el) {
    var $dialog = $(el);
    var mx = 0, my = 0;
    var dx = 0, dy = 0;
    var isDraging = false;

    $dialog.mousedown(function (e) {
        e = e || window.event;
        mx = e.pageX;
        my = e.pageY;
        dx = $dialog.offset().left;
        dy = $dialog.offset().top;
        isDraging = true;
    });
    $(document).mousemove(function (e) {
        var e = e || window.event;
        var x = e.pageX;
        var y = e.pageY;
        if (isDraging) {
            var moveX = dx + x - mx;
            var moveY = dy + y - my;

            var pageW = $(window).width();
            var pageH = $(window).height();
            var dialogW = $dialog.width();
            var dialogH = $dialog.height();
            var maxX = pageW - dialogW;
            var maxY = pageH - dialogH;
            moveX = Math.min(Math.max(0, moveX), maxX);
            moveY = Math.min(Math.max(0, moveY), maxY);
            $dialog.css({"left": moveX + 'px', "top": moveY + 'px'});
        }
    });
    $dialog.mouseup(function () {
        isDraging = false;
    });
}
